package hit.core;

/**
 * A notification object to be passed to the controller when the facade signals that
 * a change has taken place.
 */
public class ProductNotification {
	/**
	 * This enum represents the various notification types for a ProductNotification
	 * */
	public enum Type {
		PRODUCT_ADDED, PRODUCT_EDITED, PRODUCT_DELETED, PRODUCT_TRANSFERRED
	}
	
	private Type type;
	private Product modifiedProduct;
	
	/**
	 * Creates a new Instance of the Product Notification
	 * @param type The {@link Type} detailing what happened in the last update.
	 * @param modifiedProduct The {@link Product} that was changed in the last update.
	 * @throws IllegalArgumentException if Type or Product is invalid.
	 */
	public ProductNotification(Type type, Product modifiedProduct)
			throws IllegalArgumentException {
		this.type = type;
		this.modifiedProduct = modifiedProduct;
	}
	
	/**
	 * Gets the {@link Type} of Notification.
	 * @return The {@link Type}.
	 */
	public Type GetType() throws IllegalArgumentException {
		return type;
	}
	
	/**
	 * Gets the {@link Product} that was Modified.
	 * @return The Modified {@link Product}. 
	 */
	public Product GetModifiedProduct() {
		return modifiedProduct;
	}
	
	/**
	 * Sets the {@link Product} that was modified
	 * @param product the modified {@link Product} to set
	 * */
	public void SetModifiedProduct(Product product) {
		modifiedProduct = product;
	}
}
